<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.15.xsd">
    <changeSet id="init-table-TENNIS_USER_ROLES-1" author="alisitsin">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="TENNIS_USER_ROLES"/>
            </not>
        </preConditions>
        <createTable tableName="TENNIS_USER_ROLES">
            <column name="TENNIS_USER_ROLE_ID" type="integer" remarks="Идентификатор роли пользователя сервиса (первичный ключ)">
                <constraints primaryKey="true" primaryKeyName="PK_TENNIS_USER_ROLE_ID" nullable="false"/>
            </column>
            <column name="NAME" type="varchar(255)" remarks="Имя пользователя"/>
            <column name="CODE" type="varchar(255)" remarks="Фамилия пользователя"/>
        </createTable>
        <comment>create table TENNIS_USER_ROLES</comment>
    </changeSet>

    <changeSet id="add-TENNIS_USER_ROLE_SEQ_GEN-1" author="alisitsin">
        <preConditions onFail="MARK_RAN">
            <not>
                <sequenceExists sequenceName="TENNIS_USER_ROLE_ID_SEQ"/>
            </not>
        </preConditions>
        <createSequence sequenceName="TENNIS_USER_ROLE_ID_SEQ" minValue="1000" maxValue="9223372036854775807"
                        startValue="1000" incrementBy="1"/>
        <comment>add TENNIS_USER_ROLE seq</comment>
    </changeSet>

</databaseChangeLog>